#include <iostream>
#include <string>

#include "string.h"
using namespace std;
void test1()
{
	using namespace std;
	/*string str_1("avbdecde");
	string::iterator it = str_1.begin();
	while (it != str_1.end())
	{
		std::cout << *it;
		it++;
	}*/
	/*string str_1;
	std::string str_2;
	std::cout << (str_2.begin() == str_2.end()) << std::endl;
	std::cout << (str_1.begin() == str_1.end()) << std::endl;*/
	string str_2 = "dedvdegiea";
	cout << str_2.size() << endl;
	cout << str_2.capacity() << endl;
	str_2.reserve(str_2.size() * 2);
	cout << str_2.capacity() << endl;
}
void test2()
{
	/*simulation::string str_1 = "deigndaeghde";
	cout << str_1.size() << endl;
	cout << str_1.capacity() << endl;
	str_1.reserve(str_1.size() / 2);
	cout << str_1.capacity() << endl;
	str_1.reserve(str_1.capacity() * 2);*/
	simulation::string str_1 = "Hello world";
	for (size_t i = 0; i < str_1.size(); i++)
	{
		cout << str_1[i];
	}
	cout << endl;
	for (auto ch : str_1)
	{
		cout << ch;
	}
	/*cout << endl;
	auto it = str_1.begin();
	while (it != str_1.end())
	{
		cout << *it;
		it++;
	}*/
}
void test3()
{
	simulation::string str_1("Hello world!");
	str_1 += "boundary";
	for (int i = 0; i < 20; i++)
	{
		str_1 += 'x';
	}
	cout << str_1.c_str() << endl;
}

void test4()
{
	simulation::string str_1("Hello world");
	cout << str_1.size() << endl;
	str_1.insert(str_1.size(), "deca");
	cout << str_1.c_str() << endl;
	cout << str_1.size() << endl;


	simulation::string str_2("Hello world");
	str_2.insert(0, "");
	cout << str_2.c_str() << endl;
	cout << str_2.size() << endl;
}

void test5()
{
	simulation::string str_1("Hello world");
	str_1.erase();
	cout << str_1.size() << endl;

	simulation::string str_2("Hello world");
	str_2.erase(0, 5);
	cout << str_2.size() << endl;

	simulation::string str_3("Hello world");
	str_3.erase(5, 5);
	cout << str_3.size() << endl;

	simulation::string str_4("Hello world");
	str_4.erase(5, 15);
	cout << str_4.size() << endl;
}
void test6()
{
	simulation::string str_1("Hello world");
	str_1 += '\0';
	str_1 += "ccccccccc";
	//cout << str_1 << endl;
	cout << str_1.find('c') << endl;
	cout << str_1.find('c', str_1.size()) << endl;
	cout << str_1.find('c', str_1.size() - 1) << endl;
	cout << str_1.find('\0') << endl;
}

void test7()
{
	std::string str_1("Hello world");
	cout << str_1.find("", 8) << endl;
	str_1 += '\0';
	str_1 += "ccccccccx";
	//cout << str_1 << endl;
	cout << str_1.find("c\0cc") << endl;
	cout << str_1.find("x") << endl;
	cout << str_1.find("c\0  ") << endl;
	cout << str_1.find("ccccccccx") << endl;
}
void test8()
{
	simulation::string str_1("Hello world");
	cout << str_1.capacity() << endl;
	str_1.resize(str_1.size() + 1);
	cout << str_1.size() << endl;
	cout << str_1.capacity() << endl;

	str_1.resize(5);
	cout << str_1.size() << endl;
	cout << str_1.capacity() << endl;
}

void test9()
{
	/*simulation::string str_1 = "Orange juice seems to disagree with some babies";
	str_1.insert(24, 1, '\0');
	cout << str_1 << endl;*/

	std::string str1 = "Hello";
	std::string str2 = "Helloxxx";
	std::string str3 = "He";
	cout << (str1 == str2) << endl;
	cout << (str1 < str2) << endl;
	cout << (str1 > str2) << endl << endl;

	cout << (str1 == str3) << endl;
	cout << (str1 < str3) << endl;
	cout << (str1 > str3) << endl << endl;

	cout << (str3 == str2) << endl;
	cout << (str3 < str2) << endl;
	cout << (str3 > str2) << endl << endl;
	
}

void test10()
{
	const string str1("Hello world");
	string str2;
	str2 = str1;
	cout << str2;
}
int main()
{
	test10();

	return 0;
}